#ifndef _FL_NETWORK_PROTOCOL_MUD_H__
#define _FL_NETWORK_PROTOCOL_MUD_H__

#include "NetworkProtocol.h"

#define MUD_POPUP_UI	0x0006

#define MUD_CCONNECT	0x7000
#define MUD_CVERSION	0x7006
#define MUD_CSERVER_LIST	0x7009

#define MUD_LLOGIN		0x9000
#define MUD_LVERSION	0x9005

class NetworkProtocolMud : public NetworkProtocol
{
public:
	NetworkProtocolMud();
	virtual ~NetworkProtocolMud();

	/// Consume Packet, return used length
	virtual int consumePacket(const char* buffPacket, const int sizeBuff);

	/// Make Packet, return composed length
	virtual int makePacket(char* buffPacket, const int sizeRemain, unsigned int cmd_id, va_list* pargs);

private:
	int consumeProtocol(unsigned short func_id, char* buffPacket, int sizeRemain);
	int makeProtocol(unsigned short func_id, char* buffPacket, int sizeRemain, va_list* pargs);

	void callMudCVersion();
	void callMudCConnect(char* buffPacket, int length);
	void callMudPopupUI(char* buffPacket, int length);
	void callMudServerList(char* buffPacket, int length);
	int makeMudLVersion(char* buffPacket, int sizeRemain, va_list* pargs);
	int makeMudLLogin(char* buffPacket, int sizeRemain, va_list* pargs);
};

#endif